package com.mushuilingfeng.ddd.user.domain.base;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 沐水淋风
 * @date 2024/10/2
 */
@Getter
@AllArgsConstructor
public enum GenderEnum {
    MAN("男", 1), WOMAN("女", 2), UNKNOWN("未知", -1);
    private final String desc;
    private final int code;
    
    
    public static GenderEnum get(int code) {
        for (GenderEnum e : GenderEnum.values()) {
            if (e.code == code) {
                return e;
            }
        }
        return UNKNOWN;
    }
}
